<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BaLs.Models.Link>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Edit</h2>

    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
    <%
        string tags = string.Empty;
        foreach (var tagItem in Model.Tags)
        {
            if(tags.Equals(string.Empty))                
               tags=tagItem.tag_desc;
            else
                tags=tags + " " + tagItem.tag_desc;
        } 
        %>
    <% using (Html.BeginForm()) {%>

        <fieldset>
            <legend>Fields</legend>
            <p>
                <%--<label for="link_id">link_id:</label>
                <%= Html.TextBox("link_id", Model.link_id) %>
                <%= Html.ValidationMessage("link_id", "*") %>--%>
                <%=Html.Hidden("link_id",Model.link_id) %>
            </p>
            <p>
                <label for="url">url:</label>
                <%= Html.TextBox("url", Model.url) %>
                <%= Html.ValidationMessage("url", "*") %>
            </p>
            <p>
                <label for="title">title:</label>
                <%= Html.TextBox("title", Model.title) %>
                <%= Html.ValidationMessage("title", "*") %>
            </p>
            <p>
                <label for="notes">notes:</label>
                <%= Html.TextBox("notes", Model.notes) %>
                <%= Html.ValidationMessage("notes", "*") %>
            </p>
            <p>
                <label for="notes">Tag:</label>
                <%= Html.TextBox("tag", tags) %>
               <%-- <%= Html.ValidationMessage("notes", "*") %>--%>
            </p>
            <p>
                <label for="private_flag">private_flag:</label>
                <%--<%= Html.TextBox("private_flag", Model.private_flag) %>--%>
                <%= Html.CheckBox("private_flag",(Model.private_flag=='T'?true:false)) %>
                
                <%= Html.ValidationMessage("private_flag", "*") %>
            </p>
            <%--<p>
                <label for="owner">owner:</label>
                <%= Html.TextBox("owner", Model.owner) %>
                <%= Html.ValidationMessage("owner", "*") %>
            </p>
            <p>
                <label for="create_date">create_date:</label>
                <%= Html.TextBox("create_date", String.Format("{0:g}", Model.create_date)) %>
                <%= Html.ValidationMessage("create_date", "*") %>
            </p>--%>
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>

